var path = require('path');
var webpack = require('webpack');
const {VueLoaderPlugin} = require('vue-loader')
module.exports = {
    entry:['babel-polyfill','./src/main.js'],
    devtool:'#eval-source-map',
    output:{
        path:path.resolve(__dirname,'./dist'),
        publicPath:'/dist',
        filename:'build.js'
    },
    devServer:{
        historyApiFallback:true,
        overlay:true
    },
    resolve:{
        alias:{
            'vue$':'vue/dist/vue.esm.js'
        }
    },
    plugins: [
        new VueLoaderPlugin()
    ],    
    module:{
        rules:[
            {
                test:/\.css$/,
                use:[
                    'vue-style-loader',
                    'css-loader'
                ]
            },
            {
                test:/\.scss$/,
                use:[
                    'vue-style-loader',
                    'css-loader',
                    'sass-loader'
                ]
            },
            {
                test:/\.sass$/,
                use:[
                    'vue-style-loader',
                    'css-loader',
                    'sass-loader?indentedSyntax'
                ]
            },
            {
                test:/\.js$/,
                loader:'babel-loader',
                exclude:/node_modules/
            },
            {
                test:/\.(png|jpg|gif|svg)$/,
                loader:'file-loader',
                options:{
                    name:'[name].[ext]?[hash]'
                }
            },
            {
                test:/\.vue$/,
                loader:'vue-loader',
                options:{
                    loaders:{
                        'scss':[
                            'vue-style-loader',
                            'css-loader',
                            'sass-loader'
                        ],
                        'sass':[
                            'vue-style-loader',
                            'css-loader',
                            'sass-loader?indentedSyntax'
                        ],

                    }
                }
            }

        ]
    }
};
